import java.util.Arrays;

public class Solution867 {
    public int[][] transpose(int[][] matrix) {
        int[][] ans=new int[matrix[0].length][matrix.length];
        for (int i=0;i<matrix[0].length;i++){
            for (int j=0;j<matrix.length;j++){
                ans[i][j]=matrix[j][i];
            }
        }
        return ans;
    }

    public static void main(String[] args) {
        int[][] ans=new Solution867().transpose(new int[][]{{1,2,3},{4,5,6},{7,8,9}});
        for (int[] an : ans) {
            System.out.println(Arrays.toString(an));
        }
    }
}
